#书名 作者 图片链接 更新时间 分类

import requests
from bs4 import BeautifulSoup

url = 'http://book.zongheng.com/store.html'

response = requests.get(url)
print(response.status_code)
# print(response.text)

html = response.text

# bs4的使用
# 1、得到一个beautifulsoup对象
soup = BeautifulSoup(html,'html.parser')

# # 通过find查找 图片/书名
temp = soup.find_all(class_="bookbox")
for i in temp:
    imgSrc = i.contents[1].a.img['src']
    bookname = i.contents[3].contents[1].a.string
    print(imgSrc)
    print(bookname)
# 作者
tempx = soup.select('.bookilnk')
for i in tempx:
    print(i.a.string)
# 更新时间  分类
temp2 = soup.find_all(class_="bookilnk")
for i in temp2:
    updateTime = i.contents[7].string
    bookType = i.contents[3].string
    print(updateTime)
    print(bookType)
